



use "$dir\data\cleaned\estimation_data.dta", clear

do "$dir/code/llm_build/13.merging_alt_instruments.do"



*Figure 1: Relationship between OAS Employment Share and Technology Intensity
	preserve

	keep oas_share  contemp_mean_oas_std  year czone czone_pop inst_mean_ind_std_2000 inst_mean_ind_std_1970 
reshape wide oas_share  contemp_mean_oas_std czone_pop inst_mean_ind_std_2000 inst_mean_ind_std_1970,  i(czone)  j(year)

gen oas_pct_chg = oas_share2016-oas_share2007
gen tech_chg = contemp_mean_oas_std2016-contemp_mean_oas_std2007
gen inst_chg1970 = inst_mean_ind_std_19702016-inst_mean_ind_std_19702007

twoway (lfit tech_chg  inst_chg1970 [aweight=czone_pop2007], lcolor(black)) ///
(scatter tech_chg  inst_chg1970 [aweight=czone_pop2007], msymbol(circle_hollow) mcolor(black)), ///
graphregion(color(white)) ylabel(,nogrid) legend(off) xtitle("Change in 1970 Instrument, 2007-2016") ytitle("Change in Endogenous Tech. Measure")
graph export "$dir/output/fig1_endog_1970inst.pdf", as(pdf) replace

	restore


*Table 3: Outcomes for OAS Workers

foreach var in oas_share oas_pop_pct  oas_college_pct oas_cz_lwg_annual_r oas_cz_lwg_yr_col_r  oas_cz_lwg_yr_nocol_r  {

		
*IV, 1970 industry weights
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/table3.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}
	
		

*Table 4: OAS Wage Premium

foreach var in oas_nc_wage_gap oas_col_wage_gap oas_nc_nc_wage_gap  oas_col_col_wage_gap { 

		
*IV, 1970 industry weights
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/table4.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}
	
	
*Table 5: Spillovers	

foreach var in epop100 flfp100 mlfp100 lwg_annual_r non_oas_cz_lwg_annual_r non_oas_cz_lwg_yr_col_r  non_oas_cz_lwg_yr_nocol_r  { 

		
*IV, 1970 industry weights
		ivregress 2sls `var'  yr2_* cz2_*  ($endog   =  $inst_1970)    [aweight=czone_pop], vce(cl czone)
		outreg2   using "$dir/output/table5.xls", append dec(3) excel alpha(0.001, 0.01, 0.05) symbol(***, **, *) drop(yr2_* cz2_*  o.*)
	}

